package com.boot.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.boot.entity.User;
import com.boot.service.UserService;

@Controller
public class UserController {
@Autowired
private UserService userService;
private static Logger logger = LoggerFactory.getLogger(UserController.class);
@RequestMapping(value="user")
@ResponseBody
public String getuUser() {
	logger.debug("..........");
	User user = userService.getUser();
		logger.debug(user.getId()+"----"+user.getName()); 
		return user.getId()+"----"+user.getName();
		
}


	
	  @RequestMapping(value = "/testthymeleaf") 
	  public ModelAndView test(ModelAndView mv) { 
		  User user = userService.getUser();
		  mv.setViewName("NewFile");
		  mv.addObject("user", user);
	      return mv; 
	  }
	 


}
